Skip to contentSkip to conversation

Change in openvpn[master]: dco: pass remoteaddr only for UDP peers

Openvpn-devel In review ordex (Code Review) 2 participants 10 messages Dec 13, 2024 – Mar 9, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1734109769000.I76e2e616c6ffe436a9627fa71aaace74030b2f4a@...2715...

#1 lore raw

Attention is currently required from: flichtenheld, plaisthos.

Hello plaisthos, flichtenheld,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/842?usp=email

to review the following change.

Change subject: dco: pass remoteaddr only for UDP peers
......................................................................

dco: pass remoteaddr only for UDP peers

TCP connected sockets do not need any remote addr because the destination is fixed.
For this reason we can avoid sending the remote addr along the peer-new dco call.

This change is important on Linux because the new 'ovpn' kernel module is stricter when it comes to accepting netlink messages and will reject calls with TCP sockets if a remote address is specified.

Change-Id I76e2e616c6ffe436a9627fa71aaace74030b2f4a

---
M src/openvpn/dco.c

1 file changed, 3 insertions(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/42/842/1

src/openvpn/dco.c +3 -1
index dcc80d3..b1a3715 100644
@@ -494,7 +494,9 @@
     }
 #endif
     int ret = dco_new_peer(&c->c1.tuntap->dco, multi->peer_id,
-                           c->c2.link_socket->sd, NULL, remoteaddr, NULL, NULL);
+                           c->c2.link_socket->sd, NULL,
+                           proto_is_dgram(ls->info.proto) ? remoteaddr : NULL,
+                           NULL, NULL);
     if (ret < 0)
     {
         return ret;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/842?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I76e2e616c6ffe436a9627fa71aaace74030b2f4a
Gerrit-Change-Number: 842
Gerrit-PatchSet: 1
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, ordex, plaisthos.

stipa has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/842?usp=email )

Change subject: dco: pass remoteaddr only for UDP peers
......................................................................

Patch Set 1: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/842?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I76e2e616c6ffe436a9627fa71aaace74030b2f4a
Gerrit-Change-Number: 842
Gerrit-PatchSet: 1
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Comment-Date: Mon, 16 Dec 2024 13:16:19 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: ordex, plaisthos.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/842?usp=email )

Change subject: dco: pass remoteaddr only for UDP peers
......................................................................

Patch Set 1: Code-Review-1

(1 comment)

Patchset:

PS1:
Needs rebase due to 94b391d7ef5cb4cdac34a0d122fb9cbd11d82f75

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/842?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I76e2e616c6ffe436a9627fa71aaace74030b2f4a
Gerrit-Change-Number: 842
Gerrit-PatchSet: 1
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Comment-Date: Fri, 17 Jan 2025 15:46:03 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#4 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, ordex, plaisthos, stipa.

Hello flichtenheld, plaisthos, stipa,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/842?usp=email

to look at the new patch set (#2).

The following approvals got outdated and were removed:
Code-Review+2 by stipa, Code-Review-1 by flichtenheld

The change is no longer submittable: Code-Review and checks~ChecksSubmitRule are unsatisfied now.

Change subject: dco: pass remoteaddr only for UDP peers
......................................................................

dco: pass remoteaddr only for UDP peers

TCP connected sockets do not need any remote addr because the destination is fixed.
For this reason we can avoid sending the remote addr along the peer-new dco call.

This change is important on Linux because the new 'ovpn' kernel module is stricter when it comes to accepting netlink messages and will reject calls with TCP sockets if a remote address is specified.

Change-Id I76e2e616c6ffe436a9627fa71aaace74030b2f4a

---
M src/openvpn/dco.c

1 file changed, 3 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/42/842/2

src/openvpn/dco.c +3 -2
index 02fae81..973c848 100644
@@ -515,8 +515,9 @@
         c->c2.tls_multi->dco_peer_id = -1;
     }
 #endif
-    int ret = dco_new_peer(&c->c1.tuntap->dco, multi->peer_id,
-                           c->c2.link_sockets[0]->sd, NULL, remoteaddr, NULL, NULL);
+    int ret = dco_new_peer(&c->c1.tuntap->dco, multi->peer_id, sock->sd, NULL,
+                           proto_is_dgram(sock->info.proto) ? remoteaddr : NULL,
+                           NULL, NULL);
     if (ret < 0)
     {
         return ret;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/842?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I76e2e616c6ffe436a9627fa71aaace74030b2f4a
Gerrit-Change-Number: 842
Gerrit-PatchSet: 2
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-MessageType: newpatchset

#5 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos, stipa.

ordex has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/842?usp=email )

Change subject: dco: pass remoteaddr only for UDP peers
......................................................................

Patch Set 2:

(1 comment)

Patchset:

PS1:

Quoted 1 line

Needs rebase due to 94b391d7ef5cb4cdac34a0d122fb9cbd11d82f75

Done

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/842?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I76e2e616c6ffe436a9627fa71aaace74030b2f4a
Gerrit-Change-Number: 842
Gerrit-PatchSet: 2
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Fri, 21 Feb 2025 20:41:55 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment

#6 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, ordex, plaisthos, stipa.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/842?usp=email )

Change subject: dco: pass remoteaddr only for UDP peers
......................................................................

Patch Set 2: Code-Review+2

(1 comment)

Patchset:

PS2:
Testing on FreeBSD is not required (no TCP support in DCO). Testing on Windows is not required (in p2p mode, dco_new_peer() is a no-op).

So that leaves Linux, which seems to need it... I would have put this inside dco_linux.c, but it does not make a big difference.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/842?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I76e2e616c6ffe436a9627fa71aaace74030b2f4a
Gerrit-Change-Number: 842
Gerrit-PatchSet: 2
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Sun, 09 Mar 2025 15:29:58 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#7 lore raw

PATCH v2 1/1 dco: pass remoteaddr only for UDP peers

In reply to a message not in the archive

From: Antonio Quartulli <[email protected]...>

TCP connected sockets do not need any remote addr because the destination is fixed.
For this reason we can avoid sending the remote addr along the peer-new dco call.

This change is important on Linux because the new 'ovpn' kernel module is stricter when it comes to accepting netlink messages and will reject calls with TCP sockets if a remote address is specified.

Change-Id I76e2e616c6ffe436a9627fa71aaace74030b2f4a

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/842
This mail reflects revision 2 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

src/openvpn/dco.c +3 -2
index 02fae81..973c848 100644
@@ -515,8 +515,9 @@
         c->c2.tls_multi->dco_peer_id = -1;
     }
 #endif
-    int ret = dco_new_peer(&c->c1.tuntap->dco, multi->peer_id,
-                           c->c2.link_sockets[0]->sd, NULL, remoteaddr, NULL, NULL);
+    int ret = dco_new_peer(&c->c1.tuntap->dco, multi->peer_id, sock->sd, NULL,
+                           proto_is_dgram(sock->info.proto) ? remoteaddr : NULL,
+                           NULL, NULL);
     if (ret < 0)
     {
         return ret;
#8 lore raw

[Openvpn-devel] [PATCH applied] Re: dco: pass remoteaddr only for UDP peers

Tested with and without DCO on Ubuntu 20.04.

Not tested on FreeBSD (no TCP support in DCO) or Windows (in this particular code path, it's a no-op call).

Your patch has been applied to the master branch.

commit 90d7881e32ec371874c020f756bd35d1959e9698

Author: Antonio Quartulli
Date:   Sun Mar 9 16:30:17 2025 +0100
     dco: pass remoteaddr only for UDP peers

     Signed-off-by: Antonio Quartulli <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg31078.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#9 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#3) to the change originally created by ordex. ( http://gerrit.openvpn.net/c/openvpn/+/842?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2

Change subject: dco: pass remoteaddr only for UDP peers
......................................................................

dco: pass remoteaddr only for UDP peers

TCP connected sockets do not need any remote addr because the destination is fixed.
For this reason we can avoid sending the remote addr along the peer-new dco call.

This change is important on Linux because the new 'ovpn' kernel module is stricter when it comes to accepting netlink messages and will reject calls with TCP sockets if a remote address is specified.

Change-Id I76e2e616c6ffe436a9627fa71aaace74030b2f4a

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg31078.html

---
M src/openvpn/dco.c

1 file changed, 3 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/42/842/3

src/openvpn/dco.c +3 -2
index 02fae81..973c848 100644
@@ -515,8 +515,9 @@
         c->c2.tls_multi->dco_peer_id = -1;
     }
 #endif
-    int ret = dco_new_peer(&c->c1.tuntap->dco, multi->peer_id,
-                           c->c2.link_sockets[0]->sd, NULL, remoteaddr, NULL, NULL);
+    int ret = dco_new_peer(&c->c1.tuntap->dco, multi->peer_id, sock->sd, NULL,
+                           proto_is_dgram(sock->info.proto) ? remoteaddr : NULL,
+                           NULL, NULL);
     if (ret < 0)
     {
         return ret;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/842?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I76e2e616c6ffe436a9627fa71aaace74030b2f4a
Gerrit-Change-Number: 842
Gerrit-PatchSet: 3
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#10 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/842?usp=email )

Change subject: dco: pass remoteaddr only for UDP peers
......................................................................

dco: pass remoteaddr only for UDP peers

TCP connected sockets do not need any remote addr because the destination is fixed.
For this reason we can avoid sending the remote addr along the peer-new dco call.

This change is important on Linux because the new 'ovpn' kernel module is stricter when it comes to accepting netlink messages and will reject calls with TCP sockets if a remote address is specified.

Change-Id I76e2e616c6ffe436a9627fa71aaace74030b2f4a

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg31078.html

---
M src/openvpn/dco.c

1 file changed, 3 insertions(+), 2 deletions(-)
src/openvpn/dco.c +3 -2
index 02fae81..973c848 100644
@@ -515,8 +515,9 @@
         c->c2.tls_multi->dco_peer_id = -1;
     }
 #endif
-    int ret = dco_new_peer(&c->c1.tuntap->dco, multi->peer_id,
-                           c->c2.link_sockets[0]->sd, NULL, remoteaddr, NULL, NULL);
+    int ret = dco_new_peer(&c->c1.tuntap->dco, multi->peer_id, sock->sd, NULL,
+                           proto_is_dgram(sock->info.proto) ? remoteaddr : NULL,
+                           NULL, NULL);
     if (ret < 0)
     {
         return ret;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/842?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I76e2e616c6ffe436a9627fa71aaace74030b2f4a
Gerrit-Change-Number: 842
Gerrit-PatchSet: 3
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged